gtktext: Claim gesture more selectively
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 18 Nov 2022 12:57:02 +0000 (13:57 +0100)
committerSimon McVittie <smcv@debian.org>
Fri, 18 Nov 2022 22:12:24 +0000 (22:12 +0000)
commitf0098ef73f8725f594460b3ab8e14d2d7921a371
treecbcf0d8bc42c8886d1666c8296f503bf17e87fac
parent6641beb75f5fc5510e51415c33371e1b8d0d621d
gtktext: Claim gesture more selectively

Even though button 1 (or touch down) presses do most often have
an effect in one way or another (starting drag, moving focus,
starting selection, ...), there is one situation that they do
immediately nothing: When clicking on the entry does not move
the text caret around. Dragging might start a selection, but
the entry did not do anything just yet, and an immediate
button/touch release should remain at "did nothing".

And that is precisely the hint that the Wayland IM context's click
gesture takes, clicks that do not scroll nor move the caret around,
having the GtkText not claim the gesture in that situation makes
the IM gesture able to do its thing without in-fighting.

This is typically not a problem when the GtkText is embedded in
another GtkEditable implementation (e.g. GtkEntry), since the
IM gesture is inactive and capturing from the parent widget, so
gets a pass that it otherwise doesn't get when both gestures are
in the same widget. This makes it work regardless of GtkText not
being a child of a composite widget, like NautilusQueryEditor
and AdwRowEntry.

(cherry-picked from commit 09b982f0264e42bda3e8471bb25abec5ee742ecc)

Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5351
Origin: upstream, 4.8.3, commit:3b940b12f64c78346cbea8a2fafde24690ecd9fe

Gbp-Pq: Name gtktext-Claim-gesture-more-selectively.patch
gtk/gtktext.c